#include "stdafx.h"
#include "Settings.h"
#include "Ini.h"

CSettings::CSettings()
{
	init();
}

CSettings::~CSettings()
{
	Save();
}

void CSettings::init()
{
	m_cfgPath = GetAppDir();
	m_cfgPath+=L"\\Config.ini";
}

PCWCH CSettings::GetAppDir()
{
	static WCHAR szAppDir[MAX_PATH] = {L'\0'};
	if (L'\0' != szAppDir[0])
		return szAppDir;

	GetModuleFileName(NULL, szAppDir, MAX_PATH * sizeof(WCHAR) );
	WCHAR *pc = wcsrchr(szAppDir, L'\\');
	*pc = L'\0';

	return szAppDir;
}

void CSettings::Save()
{

}

std::wstring CSettings::GetInstallName()
{
	std::wstring wsName = L"";

	CIni iniConfig(m_cfgPath.c_str());

	TCHAR szName[MAX_PATH];
	iniConfig.GetString(L"Info",L"Install_Name",szName,MAX_PATH,L"");

	wsName = szName;
	return wsName;
}
